<?
/*
function authenticate() {
    header('WWW-Authenticate: Basic realm="Hncc Authentication System"');
    header('HTTP/1.0 401 Unauthorized');
    echo "You must enter a valid login ID and password to access this resource\n";
    exit;
}

if(!isset($_SERVER['PHP_AUTH_USER'])) {
	authenticate();

} else if ($_SERVER['PHP_AUTH_USER'] != 'hncc' || $_POST['PHP_AUTH_PW'] != '123456') {
	authenticate();
}
*/


session_start();

if( !isset($_SESSION["uid"]) ) {
	echo "<script> window.location = 'login.php'; </script>";
	exit;
}

function echo_header($filename) {
	 header("Content-type: application/octet-stream"); 
	 header("Content-Disposition: attachment; filename=".iconv("utf-8","gbk",$filename));
	 header("Pragma: no-cache");
	 header("Expires: 0");  
}


if(isset($_GET['dl_excel'])) {
	echo_header("湖南电信外包呼叫中心_网络渠道注册用户_".date("Y-m-d").".xls");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>湖南电信外包呼叫中心_网络渠道注册用户</title>
</head>
<body>
<b style='font-size:23px'>湖南电信外包呼叫中心_网络渠道注册用户</b> [<a href='<?echo $PHP_SELF?>?dl_excel=1'>下载表格</a>]
<hr size=1>
<table width=100% cellspacing=0 cellpadding=3 bgcolor=gray border=1>
<tr bgcolor=#99ccff style="font-weight:bold">
<td width=50>编号</td><td width=200>客户名称</td><td width=100>联系人</td><td width=100>联系电话</td><td width=300 nowrap>联系地址</td><td width=120>账号数</td><td width=100>外呼号码</td><td width=100>接入号码</td><td width=260>配置信息</td><td width=120>申请时间</td><td width=120>所属行业</td><td width=260>开通情况</td>
</tr>
<?
include("../../webkit/include/simple_db.php");
$db = new SimpleDB();

$sql = "select * from hncc_client where user_name='".$_SESSION["uid"]."' order by id desc";
$db->query($sql);
$i = 0;
while($db->next_record()) {
	$tr_color = ($i++%2==0) ? "#eeeeee" : "white";
?>
<tr bgcolor="<?echo $tr_color?>">
<td><?echo $db->f("id")?></td><td><font color="red"><?echo $db->f("client_name")?></font></td><td><?echo $db->f("client_person")?></td><td><?echo $db->f("client_tel")?></td><td><?echo $db->f("client_addr")?></td><td><?echo $db->f("order_count")?></td><td><?echo $db->f("callout_number")?></td><td><?echo $db->f("callin_number")?></td><td><?echo $db->f("mac_phone")?></td><td><?echo $db->f("order_date")?></td><td><?echo $db->f("client_type")?></td><td>&nbsp;</td>
</tr>
<?
}
?>
</body>
</html>